home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10930 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP. How to convert '0x12' into FF char?
  5. Date: Wed, 20 Mar 96 17:56:54 GMT
  6. Organization: none
  7. Distribution: world
  8. Message-ID: <827344614snz@genesis.demon.co.uk>
  9. References: <4iissm$s76@nntp.ucs.ubc.ca> <17MAR199623533662@erich.triumf.ca>
  10. Reply-To: fred@genesis.demon.co.uk
  11. X-NNTP-Posting-Host: genesis.demon.co.uk
  12. X-Newsreader: Demon Internet Simple News v1.27
  13. X-Mail2News-Path: genesis.demon.co.uk
  14.  
  15. In article <17MAR199623533662@erich.triumf.ca>
  16.            bennett@erich.triumf.ca "P.Bennett" writes:
  17.  
  18. >In article <4iissm$s76@nntp.ucs.ubc.ca>, gordonw@unixg.ubc.ca (Gordon Wong)
  19. > writes...
  20. >>Let's say we have d='1' and e='2' and the following code segment:
  21. >
  22. >>f='0x';
  23. >>strcpy(f,d);
  24. >>strcpy(f,e);
  25. >> 
  26. >>f now contains the string '0x12' right?
  27. >
  28. >No.
  29.  
  30. Indeed, it isn't even legal code.
  31.  
  32. >but if you have:
  33. >        char f[10] = "0x";
  34. >        char d[2] = "1";
  35. >        char e[2] = "2";
  36. >        strcpy(f,d);
  37. >        strcpy(f,e);
  38.  
  39. I assume you mean strcat() here.
  40.  
  41. >f will then contain the string "0x12".
  42.  
  43. -- 
  44. -----------------------------------------
  45. Lawrence Kirby | fred@genesis.demon.co.uk
  46. Wilts, England | 70734.126@compuserve.com
  47. -----------------------------------------
  48.